package com.bmf.module.rbac.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bmf.module.rbac.entity.RbacUserRole;
import com.bmf.module.rbac.service.RbacUserRoleService;
import com.bmf.module.rbac.vo.RbacUserRoleCreateVo;
import com.bmf.module.rbac.vo.RbacUserRoleResultVo;
import com.bmf.module.rbac.vo.RbacUserRoleUpdateVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;
import com.bmf.core.result.R;

/**
 * (RbacUserRole)表控制层
 *
 * @author makejava
 * @since 2022-12-27 15:33:18
 */
@RestController
@RequestMapping("rbacUserRole")
@Api(tags = {"用户角色接口"})
public class RbacUserRoleController{
    /**
     * 服务对象
     */
    @Resource
    private RbacUserRoleService rbacUserRoleService;


    /**
     * 通过主键查询单条数据
     *
     * @param userid 主键
     * @return 单条数据
     */
    @GetMapping("{id}")
    @ApiOperation(value = "通过用户id查询")
    public R<List<RbacUserRoleResultVo>> selectOne(@PathVariable Serializable userid) {
        List<RbacUserRoleResultVo> rbacUserRoleResultVos = rbacUserRoleService.selectOne(userid);
        return R.success(rbacUserRoleResultVos);
    }

    /**
     * 修改数据
     *
     * @param rbacUserRoleCreateVos 实体对象
     * @return 新增结果
     */
    @PostMapping
    @ApiOperation(value = "修改数据")
    public R<Void> insert(@RequestBody List<RbacUserRoleCreateVo> rbacUserRoleCreateVos) {
        rbacUserRoleService.insert(rbacUserRoleCreateVos);
        return R.ok();
    }

}

